Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Cssfilter #477

Closed
wants to merge 7 commits into from
Closed

Cssfilter #477

wants to merge 7 commits into from

Conversation

listen2
Copy link
Contributor

@listen2 listen2 commented Jul 10, 2012

Updated to the latest cssutils, remove duplicate code, and a few misc improvements.

@spladug
Copy link
Contributor

spladug commented Jul 10, 2012

Is there a change to setup.py that's missing?

@@ -31,8 +31,8 @@
from pylons.i18n import _
from mako import filters

import os
import tempfile
#import os
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find of the unused imports, but could you just delete the lines please?

}

cssutils.profile.addProfile("Reddit compat", custom_values, custom_macros)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps the profile name should be pulled out into a constant so it's not duplicated?

Nitpick: reddit should not be capitalized :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what you mean by duplication?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The string "Reddit compat" is written out twice in this code. If you wanted to change the name it'd require changing in two places.

@spladug
Copy link
Contributor

spladug commented Jul 15, 2012

I'm running this new code on every stylesheet in the database currently and so far I've found a few regressions:

  • text-shadow does not appear to always work:
  • "black 0 0 10px" is not a valid value for CSS property "text-shadow"
  • "inherit" is not a valid value for CSS property "text-shadow"
  • Likewise for box-shadow:
    • "#0c0 0 0 10px" is not a valid value for CSS property "box-shadow"

I'll let you know if I come across more in my testing.

That said, this is already proving its worth as it's found several places where the subreddit stylesheets were flat out wrong! (some url(<a href="http://i.imgur.com/...">) type stuff and border: 1px solid 2px solid black), so this is very exciting. :)

@spladug
Copy link
Contributor

spladug commented Jul 15, 2012

Additionally, and I'm not sure if this is new behaviour or not, I don't appear to get line numbers with my validation errors.

@listen2
Copy link
Contributor Author

listen2 commented Jul 16, 2012

None of the three examples above are valid CSS. See the grammars at W3C [1] [2] [3]. The legacy code seems to be letting them through due to a custom rule. I can add that rule if you want to preserve the incorrect behavior.

It looks like the new cssutils doesn't report line numbers for validation errors, only for parse errors. If it's important, I can look again more closely later this week.

[1] http://www.w3.org/TR/css3-text/#text-shadow
[2] http://www.w3.org/TR/css3-background/#box-shadow
[3] http://www.w3.org/TR/css3-background/#ltshadowgt

@spladug
Copy link
Contributor

spladug commented Jul 16, 2012

Both inherit and color length length length seem to validate just fine for me on the W3C CSS validator. MDN says that's valid syntax, though the CSS3 spec seems to indicate otherwise (but perhaps I'm misreading the grammar there).

@listen2
Copy link
Contributor Author

listen2 commented Jul 16, 2012

Ah, my mistake; I misinterpreted the spec.

@spladug
Copy link
Contributor

spladug commented Jul 16, 2012

Alrighty, looks like that covers everything in the existing stylesheets that is actually valid. Gonna do a final code-review pass then we should be good to go! :)

@alienth
Copy link
Contributor

alienth commented May 9, 2013

Unfortunately there is an infinite recursion bug in cssutils 0.9.10 holding this back. We'll follow up once that can be addressed.

@cBlank
Copy link

cBlank commented May 10, 2013

Thanks a lot, can't wait. (Hopefully not another 10 months xD).

@empyrical
Copy link
Contributor

If it's still present, how can the infinite recursion bug be reproduced?

@spladug
Copy link
Contributor

spladug commented Apr 29, 2014

Closing because this has been obviated by the replacement of cssutils with tinycss2. Thanks for the contribution and sorry for it not getting merged.

@spladug spladug closed this Apr 29, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
5 participants